﻿using System;
using System.Drawing;
using System.Windows.Forms;

namespace demo08_图片绘制
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            //Image img = Image.FromFile("天使.png");
            Image img = new Bitmap("天使.png");   //Bitmap是Image派生类
            Bitmap bitmap = new Bitmap("企鹅.png");
            g.DrawImage(img, 120, 20);
            g.DrawImage(bitmap, 450, 85);
            g.Dispose();
            img.Dispose();
            bitmap.Dispose();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Graphics g = this.CreateGraphics();
            g.Clear(BackColor);
            g.Dispose();
        }
    }
}
